package com.procurement.bidding.controller;

import com.procurement.bidding.service.PcmAuditService;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.RemoteJobService;
import com.ruoyi.system.api.domain.PcmAudit;
import com.ruoyi.system.api.domain.SysJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.Reference;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@RestController
@RequestMapping("/remainDone")
public class PcmAuditController extends BaseController {

    @Autowired
    private PcmAuditService pas;

    @Autowired
    private RemoteJobService rjs;

    /**
     * 用于定时任务跨服务调用添加待办
     * @param pcmAudit 待办表
     * @return 添加情况
     */
    @PostMapping("/addToExamine")
    public AjaxResult addToExamine(PcmAudit pcmAudit){
        return toAjax(pas.addToExamine(pcmAudit));
    }


//    @GetMapping("/ceShi")
//    public Integer ceShi(){
//        SysJob sysJob = new SysJob();
//        sysJob.setJobName("jobName");
//        sysJob.setJobGroup("DEFAULT");
//        StringBuilder str = new StringBuilder();
//        str.append("ryTask.updateProjectStatus(2L,5,6L)");
//        sysJob.setInvokeTarget(str.toString());
//        sysJob.setCronExpression("0/1 * * * * ?");
//        sysJob.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
//        sysJob.setCreateTime(new Date());
//        sysJob.setDelayInSeconds("2023-12-31 17:02:00");
//        Long jobId = rjs.addTask(sysJob, SecurityConstants.INNER);
//        sysJob.setJobId(jobId);
//        rjs.runStartAt(sysJob,SecurityConstants.INNER);
//        return  1;
//    }


}
